import { get, post, put, del } from '@/utils/http/request'
import { R, P } from '@/utils/http/type'

export * from './types/attribute'

import { AttributeList } from './types/attribute'

export const updateAttribute = async (id: number, data: any) => {
  return put(`/goods/rule/${id}`, data)
}

export const getAttributelist = () => {
  return get<P<AttributeList>>('/goods/rule')
}

export const addAttributeSpecs = (data: any) => {
  return post<FormData>('/goods/rule', data)
}

export const deleteAttributeSpecs = (id: number) => {
  return del<FormData>(`/goods/rule/${id}`)
}
export const getAttributeDetail = (id: number) => {
  return get<R<AttributeList>>(`/goods/rule/${id}`)
}
